package com.le.admin.current.api.login;

import com.google.protobuf.ServiceException;
import com.le.common.basic.domin.AjaxResult;
import com.le.core.login.Service.LoginService;
import com.le.core.login.domin.PhoneCodeLoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/phone")
public class PhoneCodeLoginController {

    @Autowired
    private LoginService<PhoneCodeLoginUser> loginService;


    @PostMapping("/login")
    public AjaxResult login(@RequestBody PhoneCodeLoginUser phoneCodeLoginUser) throws ServiceException {
        return AjaxResult.success().put("token",loginService.login(phoneCodeLoginUser));
    }

}
